import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class FetchService extends BaseService<any> {
  private readonly logger = new Logger(FetchService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * image
   * 对应 PHP: FetchService_api::image()
   * 逻辑类型: undefined - undefined
   */
  async image(url: string) {
    // 基于PHP真实逻辑: image
    // PHP原文: $dir = $this->root_path.'/'.'image'.'/'.$this->site_id.'/'.date('Ym').'/'.date('d');         $core_upload_service = new CoreFetchService();         re...
const dir = this.root_path + '/' + 'image' + '/'.this.site_id + '/'.date('Ym') + '/'.date('d'];
        const core_upload_service = this.coreFetchService;
        return core_upload_service.image(url, this.site_id, dir);
    }


}
  }
}
